package br.unisinos.aidk.samples;

import br.unisinos.aidk.rules.Assertion;
import br.unisinos.aidk.rules.FactSet;
import br.unisinos.aidk.rules.InferenceEngine;
import br.unisinos.aidk.rules.Rule;
import br.unisinos.aidk.rules.RuleSet;

public class Rules1 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		RuleSet rules = new RuleSet();
		
		//IF ka = va THEN kc = vc
		rules.addRule(new Rule("x","cabelo","x","mamifero"));
		rules.addRule(new Rule("x","produz_leite","x","mamifero"));
		rules.addRule(new Rule("x","penas","x","passaro"));
		//IF (ka1 = va1) AND (ka2 = va2) THEN kc = vc
		rules.addRule(new Rule("x","voa","x","poe_ovos","x","passaro"));
		rules.addRule(new Rule("x","mamifero","x","come_carne","x","carnivoro"));
		
		FactSet facts = new FactSet();
		
		facts.addFact(new Assertion("rex","cabelo"));
		facts.addFact(new Assertion("rex","come_carne"));
		facts.addFact(new Assertion("louro","penas"));
		facts.addFact(new Assertion("louro","voa"));
		
		facts.addFact(new Assertion("louro","poe_ovos"));
		facts.addFact(new Assertion("vaca","produz_leite"));
		
		InferenceEngine engine = new InferenceEngine();
		engine.setRules(rules);
		engine.setFacts(facts);
		
		engine.start();
		engine.result();
	}
}
